(function(){
	if(!window.cell) window.cell={};
	if(!window.cell.console) window.cell.console={
		overwrite: true,
		svcConsole: Components.classes['@mozilla.org/consoleservice;1'].getService(Components.interfaces.nsIConsoleService),
		log:function(msg){
			this.svcConsole.logStringMessage(msg);
		},
	};
	if(!window.cell.title) window.cell.title = {
		version: "2.0.2",
		modifier: document.documentElement.getAttribute("titlemodifier"),
		separator: document.documentElement.getAttribute("titlemenuseparator"),
		svcAppInfo: Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo),
		update: function(){
			if (!gBrowser.mTabbedMode){
				gBrowser.updateTitlebar();
			}
		},
		clear: function(){
			document.documentElement.setAttribute("titlemodifier","");
			document.documentElement.setAttribute("titlemenuseparator","");
			window.setTimeout("gBrowser.updateTitlebar();", 50);
		},
		set: function(title){
			document.documentElement.setAttribute("titlemodifier",title);
			document.documentElement.setAttribute("titlemenuseparator"," - ");
			window.setTimeout("gBrowser.updateTitlebar();", 50);
		},
		customize: function(title){
			
			title=title.replace(/\$ua/g, navigator.userAgent);
			title=title.replace(/\$i/g, this.svcAppInfo.ID);
			title=title.replace(/\$b/g, this.svcAppInfo.appBuildID);
			title=title.replace(/\$v/g, this.svcAppInfo.version);
			return title;
		},
		log:function(str){
			cell.console.log(str);
		},
	};
})();